#ifndef CONTEXT_H_
#define CONTEXT_H_

#include <string>

namespace lib {

  class State;
  class Event;
  class Book;
  class Customer;

  class Context {
  public:
    void onError(const State& s, const Event& e);
    void onEnter(const State& s);
    void onEvent(const Event& e);
    void putMessage(const wchar_t* msg);

    bool dbReserve(const Book& book, const Customer& customer);
    bool dbCancelreserve(const Book& book);
    bool dbLend(const Book& book, const Customer& customer);
    bool dbReturn(const Book& book);

  protected:
    virtual void do_onError(const State& s, const Event& e) =0;
    virtual void do_onEnter(const State& s) =0;
    virtual void do_onEvent(const Event& e) =0;
    virtual void do_putMessage(const wchar_t* msg) =0;

    virtual bool do_dbReserve(const Book& book, const Customer& customer) =0;
    virtual bool do_dbCancelreserve(const Book& book) =0;
    virtual bool do_dbLend(const Book& book, const Customer& customer) =0;
    virtual bool do_dbReturn(const Book& book) =0;
  };

}

#endif

